<template>
	<div>
		<el-card>
			<!-- 面包屑导航区域 -->
			<el-breadcrumb separator-class="el-icon-arrow-right">
				<el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
				<el-breadcrumb-item>客户系统</el-breadcrumb-item>
				<el-breadcrumb-item>我的学生</el-breadcrumb-item>
			</el-breadcrumb>
			<el-form :inline="true" :model="formInline" class="demo-form-inline">
				<el-form-item label="学生姓名:">
					<el-input v-model="formInline.Name" placeholder="请输入学生姓名" clearable></el-input>
				</el-form-item>
				<el-form-item label="电话:">
					<el-input v-model="formInline.Phone" placeholder="请输入电话" clearable></el-input>
				</el-form-item>
				<el-form-item label="创建时间:">
					<el-date-picker v-model="formInline.CreateTimeStart" type="date" placeholder="选择日期" clearable>
					</el-date-picker>
				</el-form-item>
				<el-form-item label="-">
					<el-date-picker v-model="formInline.CreateTimeEnd" type="date" placeholder="选择日期" clearable>
					</el-date-picker>
				</el-form-item>
				<el-form-item label="QQ:">
					<el-input v-model="formInline.QQ" placeholder="请输入QQ" clearable></el-input>
				</el-form-item>
				<el-form-item label="咨询师:" v-show="IsShow">
					<el-select v-model="formInline.AskerId" placeholder="">
						<el-option label="请选择" value=""></el-option>
						<el-option v-for="item in pageUserlist" :label="item.LoginName" :value="item.Id"></el-option>
						</el-option>
					</el-select>
				</el-form-item>
				<el-form-item>
					<el-button type="primary" plain @click="onSubmit">查询</el-button>
				</el-form-item>
			</el-form>
			<el-button type="primary" @click="TableRowVisible=true" plain size="medium">设置</el-button>
			<el-button type="success" @click="downloadExcel()" plain size="medium">导出Excel</el-button>
			<el-button type="primary" @click="SetAsker" size="medium" plain v-show="IsShow">批量设置咨询师</el-button>
			<el-button type="primary" @click="AddStuVisible = true" plain size="medium" v-show="IsAdd">新增</el-button>
			<el-table :data="tableData"  border tooltip-effect="dark" style="width: 100%"
				ref="multipleTable" @selection-change="handleSelectionChange">
				<el-table-column fixed="left" type="selection">
				</el-table-column>
				<el-table-column fixed="left" prop="Id" label="序号" v-if="TableShow.Id" align="center">
				</el-table-column>
				<el-table-column fixed="left" prop="Name" label="学生姓名" v-if="TableShow.Name" align="center">
				</el-table-column>
				<el-table-column prop="Age" label="年龄" v-if="TableShow.Age" align="center">
				</el-table-column>
				<el-table-column prop="Sex" label="性别" v-if="TableShow.Sex" align="center">
				</el-table-column>
				<el-table-column prop="Phone" label="电话" v-if="TableShow.Phone" align="center">
				</el-table-column>
				<el-table-column prop="AskName" label="咨询师" v-if="TableShow.AskName" align="center">
				</el-table-column>
				<el-table-column prop="Addres" label="地址" v-if="TableShow.Addres" align="center">
				</el-table-column>
				<el-table-column prop="QQ" label="QQ" v-if="TableShow.QQ" align="center">
				</el-table-column>
				<el-table-column prop="Money" label="金额" v-if="TableShow.Money" align="center">
				</el-table-column>
				<el-table-column prop="CreateTime" label="创建时间" v-if="TableShow.CreateTime" align="center">
				</el-table-column>
				<el-table-column prop="Contenta" label="内容" v-if="TableShow.Contenta" align="center">
				</el-table-column>
				<el-table-column prop="IsValid" label="是否回访" v-if="TableShow.IsValid" align="center">
				</el-table-column>
				<el-table-column prop="IsHome" label="是否上门" v-if="TableShow.IsHome" align="center">
				</el-table-column>
				<el-table-column prop="IsPay" label="是否支付" v-if="TableShow.IsPay" align="center">
				</el-table-column>
				<el-table-column fixed="right" label="操作" width="450px" align="center">
					<template slot-scope="scope">
						<el-button @click="LookhandleClick(scope.row)" type="primary" icon="el-icon-search" size="mini"
							plain>查看
						</el-button>
						<el-button @click="EdithandleClick(scope.row)" type="success" icon="el-icon-edit" size="mini"
							plain>
							编辑
						</el-button>
						<el-button @click="TrackhandleClick(scope.row)" type="warning" icon="el-icon-place" size="mini"
							plain>跟踪
						</el-button>
						<el-button @click="DelhandleClick(scope.row.Id)" type="danger" icon="el-icon-delete" size="mini"
							plain>删除
						</el-button>
						<el-button @click="JournalhandleClick(scope.row)" type="infor" icon="el-icon-tickets"
							size="mini" plain>日志
						</el-button>
					</template>
				</el-table-column>
			</el-table>
			<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" background
				:current-page="page" :page-sizes="[5, 10, 15]" :page-size="limit"
				layout="total, sizes, prev, pager, next, jumper" :total="count">
			</el-pagination>
		</el-card>
		<!-- 跟踪对话框 -->
		<el-dialog title="跟踪" :close-on-click-modal="false" :visible.sync="dialogFormVisible" @close="addDialogClosed">
			<el-form :model="NetFolInfo">
				<el-form-item label="姓名:" :label-width="formLabelWidth">
					<span style="color: darkorange; font-weight: bold;">{{NetFolInfo.StudentName}}</span>
				</el-form-item>
				<el-form-item label="跟踪类型:" :label-width="formLabelWidth">
					<el-select v-model="NetFolInfo.FollowType" placeholder="请选择类型">
						<el-option label="面谈" value="面谈">面谈</el-option>
						<el-option label="电话" value="电话">电话</el-option>
						<el-option label="网络" value="网络">网络</el-option>
					</el-select>
				</el-form-item>
				<el-form-item label="跟踪状态:" :label-width="formLabelWidth">
					<el-select v-model="NetFolInfo.FollowState" placeholder="请选择状态">
						<el-option label="思量" value="思量">思量</el-option>
						<el-option label="上门未报名" value="上门未报名">上门未报名</el-option>
						<el-option label="报名未进班" value="报名未进班">报名未进班</el-option>
						<el-option label="未上门" value="未上门">未上门</el-option>
					</el-select>
				</el-form-item>
				<el-form-item v-show="IsShow" label="跟踪者" :label-width="formLabelWidth">
					<el-select v-model="NetFolInfo.UserId">
						<el-option v-for="item in Askerlist" :label="item.LoginName" :value="item.Id"></el-option>
					</el-select>
				</el-form-item>
				<el-form-item label="描述:" :label-width="formLabelWidth">
					<el-input type="textarea" :rows="3" maxlength="1000" placeholder="请输入内容"
						v-model="NetFolInfo.Content">
					</el-input>
				</el-form-item>
			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button @click="dialogFormVisible = false">取 消</el-button>
				<el-button type="primary" @click="TrackInfo">确 定</el-button>
			</div>
		</el-dialog>
		<!-- 编辑 -->
		<el-dialog title="编辑" :visible.sync="EditdialogFormVisible">
			<el-form :model="form" label-width="100px">
				<el-form-item label="姓名">
					<el-input v-model="form.Name" autocomplete="off"></el-input>
				</el-form-item>
				<el-form-item label="性别">
					<el-input v-model="form.Sex" autocomplete="off"></el-input>
				</el-form-item>
				<el-form-item label="年龄">
					<el-input v-model="form.Age" autocomplete="off"></el-input>
				</el-form-item>
				<el-form-item label="电话">
					<el-input v-model="form.Phone" autocomplete="off"></el-input>
				</el-form-item>
				<el-form-item label="QQ">
					<el-input v-model="form.QQ" autocomplete="off"></el-input>
				</el-form-item>
				<el-form-item label="微信">
					<el-input v-model="form.WeiXin" autocomplete="off"></el-input>
				</el-form-item>
				<el-form-item label="是否访问:">
					<el-switch v-model="form.IsValid" active-color="#13ce66" active-value="是" inactive-value="否"
						active-text="是" inactive-text="否">
					</el-switch>
				</el-form-item>
				<el-form-item label="是否回访">
					<el-switch v-model="form.IsReturnVist" active-color="#13ce66" active-value="是" inactive-value="否"
						active-text="是" inactive-text="否">
					</el-switch>
				</el-form-item>
				<el-form-item label="是否上门">
					<el-switch v-model="form.IsHome" active-color="#13ce66" active-value="是" inactive-value="否"
						active-text="是" inactive-text="否">
					</el-switch>
				</el-form-item>
				<el-form-item label="是否支付">
					<el-switch v-model="form.IsPay" active-color="#13ce66" active-value="是" inactive-value="否"
						active-text="是" inactive-text="否">
					</el-switch>
				</el-form-item>
				<el-form-item label="金额">
					<el-input v-model="form.Money" autocomplete="off"></el-input>
				</el-form-item>
			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button @click="EditdialogFormVisible = false">取 消</el-button>
				<el-button type="primary" @click="editset">确 定</el-button>
			</div>
		</el-dialog>
		<!-- 展示表格列 -->
		<el-dialog :close-on-click-modal="false" title="显示列" :visible.sync="TableRowVisible">
			<el-checkbox v-model="TableShow.Id">序号</el-checkbox>
			<el-checkbox v-model="TableShow.Name">学生姓名</el-checkbox>
			<el-checkbox v-model="TableShow.Age">年龄</el-checkbox>
			<el-checkbox v-model="TableShow.Sex">性别</el-checkbox>
			<el-checkbox v-model="TableShow.Phone">电话</el-checkbox>
			<el-checkbox v-model="TableShow.AskName">咨询师</el-checkbox>
			<el-checkbox v-model="TableShow.Addres">地址</el-checkbox>
			<el-checkbox v-model="TableShow.QQ">QQ</el-checkbox>
			<el-checkbox v-model="TableShow.Money">金额</el-checkbox>
			<el-checkbox v-model="TableShow.CreateTime">创建时间</el-checkbox>
			<el-checkbox v-model="TableShow.Contenta">内容</el-checkbox>
			<el-checkbox v-model="TableShow.IsValid">是否回访</el-checkbox>
			<el-checkbox v-model="TableShow.IsHome">是否上门</el-checkbox>
			<el-checkbox v-model="TableShow.IsPay">是否支付</el-checkbox>
		</el-dialog>
		<el-dialog :close-on-click-modal="false" :visible.sync="StuFormVisible" @close="closenet">
			<el-form :inline="true" :model="netInline" class="demo-form-inline">
				<el-form-item label="开始时间">
					<el-date-picker v-model="netInline.TimeStart" type="datetime" placeholder="选择日期时间">
					</el-date-picker>
				</el-form-item>
				<el-form-item label="结束时间">
					<el-date-picker v-model="netInline.TimeEnd" type="datetime" placeholder="选择日期时间">
					</el-date-picker>
				</el-form-item>
				<el-form-item>
					<el-button type="primary" @click="onSubmitnet">查询</el-button>
				</el-form-item>
			</el-form>
			<el-table :data="stuform" border style="width: 100%">
				<el-table-column prop="StudentName" label="姓名">
				</el-table-column>
				<el-table-column prop="FollowTime" label="跟踪时间">
				</el-table-column>
				<el-table-column prop="Content" label="内容">
				</el-table-column>
				<el-table-column prop="NextFollowTime" label="下次跟踪时间">
				</el-table-column>
				<el-table-column label="操作">
					<template slot-scope="scope">
						<el-button @click="ReadRow(scope.row)" type="text" size="small">
							查看
						</el-button>
					</template>
				</el-table-column>
			</el-table>
			<el-pagination @size-change="changgelimit" @current-change="chagngepage" :current-page="askpage"
				:page-sizes="[5, 10, 15, 20]" :page-size="100" layout="total, sizes, prev, pager, next, jumper"
				:total="askcount">
			</el-pagination>
			<div slot="footer" class="dialog-footer">
				<el-button type="primary" @click="StuFormVisible=false">确 定</el-button>
			</div>
		</el-dialog>
		<!-- 查看 -->
		<el-dialog title="收货地址" :visible.sync="SelectVisible">
			<el-form :model="form" class="fors">
				<el-form-item label="活动名称" :label-width="formLabelWidth">
					<el-input disabled v-model="form.Name" auto-complete="off"></el-input>
				</el-form-item>
				<el-form-item label="年龄" :label-width="formLabelWidth">
					<el-input disabled v-model="form.Age" auto-complete="off"></el-input>
				</el-form-item>
				<el-form-item label="性别" :label-width="formLabelWidth">
					<el-input disabled v-model="form.Sex" auto-complete="off"></el-input>
				</el-form-item>
				<el-form-item label="手机号" :label-width="formLabelWidth">
					<el-input disabled v-model="form.Phone" auto-complete="off"></el-input>
				</el-form-item>
				<el-form-item label="地址" :label-width="formLabelWidth">
					<el-input disabled v-model="form.Address" auto-complete="off"></el-input>
				</el-form-item>
				<el-form-item label="qq" :label-width="formLabelWidth">
					<el-input disabled v-model="form.QQ" auto-complete="off"></el-input>
				</el-form-item>
				<el-form-item label="微信" :label-width="formLabelWidth">
					<el-input disabled v-model="form.Weixin" auto-complete="off"></el-input>
				</el-form-item>
				<el-form-item label="创建时间" :label-width="formLabelWidth">
					<el-input disabled v-model="form.CreateTime" auto-complete="off"></el-input>
				</el-form-item>
			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button @click="SelectVisible = false">取 消</el-button>
				<el-button type="primary" @click="SelectVisible = false">确 定</el-button>
			</div>
		</el-dialog>
		<!-- 查看 -->
		<el-dialog title="查看内容" :visible.sync="ReadVisible">
			<el-form :model="RiZhi">
				<el-form-item label="追踪内容" :label-width="formLabelWidth">
					<el-input type="textarea" disabled :rows="3" v-model="RiZhi.Content">
					</el-input>
				</el-form-item>
			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button type="primary" @click="ReadVisible = false">确 定</el-button>
			</div>
		</el-dialog>
		<!-- 新增学生 -->
		<el-dialog title="新增学生"  :close-on-click-modal="false" :visible.sync="AddStuVisible" @close="closeadd">
			<el-form :model="AddStuForm" :rules="rules" ref="ruleForm">
				<el-form-item label="学生姓名:" prop="Name" :label-width="formLabelWidth">
					<el-input v-model="AddStuForm.Name" auto-complete="off"></el-input>
				</el-form-item>
				<el-form-item label="年龄:" prop="Age" :label-width="formLabelWidth">
					<el-input v-model="AddStuForm.Age" auto-complete="off"></el-input>
				</el-form-item>
				<el-form-item label="性别:"  :label-width="formLabelWidth">
					 <el-radio v-model="AddStuForm.Sex" label="男">男</el-radio>
					  <el-radio v-model="AddStuForm.Sex" label="女">女</el-radio>
				</el-form-item>
				<el-form-item label="手机号:" prop="Phone" :label-width="formLabelWidth">
					<el-input v-model="AddStuForm.Phone" auto-complete="off"></el-input>
				</el-form-item>
				<el-form-item label="QQ:" :label-width="formLabelWidth">
					<el-input v-model="AddStuForm.QQ" auto-complete="off"></el-input>
				</el-form-item>
				<el-form-item label="微信:" :label-width="formLabelWidth">
					<el-input v-model="AddStuForm.WeiXin" auto-complete="off"></el-input>
				</el-form-item>
				<el-form-item label="咨询师:" prop="AskerId" :label-width="formLabelWidth">
					<el-select v-model="AddStuForm.AskerId" placeholder="" >
						<el-option v-for="item in pageUserlist" :label="item.LoginName" :value="item.Id"></el-option>
						</el-option>
					</el-select>
				</el-form-item>
				<el-form-item label="是否缴费:" :label-width="formLabelWidth">
					<el-switch v-model="AddStuForm.IsPay" active-color="#13ce66" active-value="是" inactive-value="否"
						active-text="是" inactive-text="否">
					</el-switch>
				</el-form-item>
				<el-form-item label="缴费金额:" v-show="AddStuForm.IsPay=='是'?true:false" :label-width="formLabelWidth">
					<el-input v-model="AddStuForm.Money" type="number" auto-complete="off"></el-input>
				</el-form-item>
				<el-form-item label="是否有效:" :label-width="formLabelWidth">
					<el-switch v-model="AddStuForm.IsValid" active-color="#13ce66" active-value="是" inactive-value="否"
						active-text="是" inactive-text="否">
					</el-switch>
				</el-form-item>
				<el-form-item label="回访情况:" :label-width="formLabelWidth">
					<el-switch v-model="AddStuForm.IsReturnVist" active-color="#13ce66" active-value="是"
						inactive-value="否" active-text="是" inactive-text="否">
					</el-switch>
				</el-form-item>
			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button @click="AddStuVisible = false">取 消</el-button>
				<el-button type="primary" @click="AddStudent">确 定</el-button>
			</div>
		</el-dialog>
		<!-- 批量设置咨询师 -->
		<el-dialog title="批量设置咨询师" :visible.sync="SetAskerVisible">
			<el-form :model="SetAskerForm">
				<el-form-item label="跟踪者" :label-width="formLabelWidth">
					<el-select v-model="SetAskerForm.UserId">
						<el-option v-for="item in Askerlist" :label="item.LoginName" :value="item.Id"></el-option>
					</el-select>
				</el-form-item>
			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button @click="SetAskerVisible = false">取 消</el-button>
				<el-button type="primary" @click="SetAllAsker">确 定</el-button>
			</div>
		</el-dialog>
	</div>
</template>

<script>
	export default {
		data() {
			return {
				// 角色数据数据
				netInline: {
					TimeStart: "",
					TimeEnd: ""
				},
				Askerlist: [],
				pageUserlist: [],
				formInline: {
					Name: '',
					Phone: '',
					QQ: '',
					AskerId: '',
					CreateTimeStart: '',
					CreateTimeEnd: ''
				},
				LookdialogFormVisible: false,
				Lookform: {
					Name: '',
					CreateTime: ''
				},
				EditdialogFormVisible: false,
				dialogFormVisible: false,
				form: {},
				formLabelWidth: '120px',
				tableData: [],
				page: 1,
				limit: 5,
				count: 0,
				IsShow: false,
				IsAdd: false,
				TableShow: {
					Id: true,
					Name: true,
					Age: true,
					Sex: true,
					Phone: true,
					AskName: true,
					Addres: true,
					QQ: true,
					Money: true,
					CreateTime: true,
					Contenta: true,
					IsValid: true,
					IsHome: true,
					IsPay: true
				},
				TableRowVisible: false,
				NetFolInfo: {
					StudentId: '',
					StudentName: '',
					UserId: '',
					Content: '',
					FollowType: '',
					FollowState: ''
				},
				stu: {},
				stuform: [],
				StuFormVisible: false,
				SelectVisible: false,
				SetAskerVisible: false,
				ReadVisible: false,
				AddStuVisible: false,
				askpage: 1,
				asklimit: 5,
				askcount: 0,
				multipleSelection: [],
				SetAskerForm: {},
				Ids: [],
				RiZhi: {},
				AddStuForm: {
					Sex:"男"
				},
				 rules: {
				          Name: [
				            { required: true, message: '请输入学生姓名', trigger: 'blur' }
				          ],
				          Age: [
				            { required: true, message: '请输入年龄', trigger: 'blur' }
				          ],
				          Phone: [
				            {required: true, message: '请输入手机号', trigger: 'blur' }
				          ],
				          AskerId: [
				            { required: true, message: '请选择咨询师', trigger: 'blur' }
				          ]
				        }
			}
		},
		methods: {
			onSubmit() {
				this.GetStudentTable();
			},
			handleSizeChange(val) {
				this.limit = val;
				this.GetStudentTable();
			},
			handleCurrentChange(val) {
				this.page = val;
				this.GetStudentTable();
			},
			async getPagelist() {
				const {
					data: res
				} = await this.$http.get('api/Student/GetPageList')
				this.pageUserlist = res.data;
			},
			async GetStudentTable() {
				const {
					data: res
				} = await this.$http.get('api/Student/GetAllPage', {
					params: {
						page: this.page,
						limit: this.limit,
						Name: this.formInline.Name,
						Phone: this.formInline.Phone,
						AskerId: this.formInline.AskerId,
						QQ: this.formInline.QQ,
						CreateTimeStart: this.formInline.CreateTimeStart,
						CreateTimeEnd: this.formInline.CreateTimeEnd,
						Id: parseInt(window.sessionStorage.getItem('token'))
					}
				})
				this.count = res.count;
				this.tableData = res.data;
				this.IsShow = res.IsShow;
				if (res.IsAdd == 1) {
					this.IsAdd = true;
				} else {
					this.IsAdd = false;
				}
			},
			async TrackhandleClick(row) {
				const {
					data: res
				} = await this.$http.get('api/NetFol/pageUserlist')
				this.Askerlist = res.data;
				this.NetFolInfo.StudentId = row.Id;
				this.NetFolInfo.StudentName = row.Name;
				this.NetFolInfo.UserId = row.AskerId;
				this.dialogFormVisible = true;
			},
			//监听添加用户对话框的关闭事件
			addDialogClosed() {
				this.NetFolInfo = {}
			},
			async TrackInfo() {
				const {
					data: res
				} = await this.$http.post('api/Student/GetGzList', this.NetFolInfo)
				if (res.code == 0) {
					this.$message.success(res.msg);
					this.getPagelist();
					this.dialogFormVisible = false;
				} else {
					this.$message.error(res.msg);
				}

			},
			async DelhandleClick(Id) {
				const confirmResult = await this.$confirm('此操作将永久删除用户, 是否继续?', '提示', {
						confirmButtonText: '确定',
						cancelButtonText: '取消',
						type: 'warning'
					})
					//如果用户取消删除则 则打印cancel字符串
					.catch(err => err)
				//如果用户确认删除则confirmResult 为confim字符串

				if (confirmResult != 'confirm') {
					return this.$message.info("已经取消删除")
				}
				const {
					data: res
				} = await this.$http.post('api/Student/DelStudent', {
					Id: Id
				})
				if (res.code != 0) {
					return this.$message.error("删除失败" + res.msg)
				}
				this.$message.success("删除成功")
				this.GetStudentTable();
			},
			EdithandleClick(row) {
				this.EditdialogFormVisible = true;
				this.form = row;
			},
			// 编辑功能
			async editset() {
				const {
					data: res
				} = await this.$http.post('api/Student/Edit', this.form)
				if (res.data != 0) {
					this.$message.success("编辑成功！");
					this.form = {};
					this.EditdialogFormVisible = false;
					this.GetStudentTable();
				} else {
					this.$message.error("编辑失败！");
				}
			},
			async JournalhandleClick(row) {
				this.stu = row
				this.onSubmitnet();
				this.StuFormVisible = true
			},
			closenet() {
				this.netInline.TimeStart = "";
				this.netInline.TimeEnd = "";
			},
			async onSubmitnet() {
				const {
					data: res
				} = await this.$http.get('api/Student/Student', {
					params: {
						TimeStart: this.netInline.TimeStart,
						TimeEnd: this.netInline.TimeEnd,
						Id: this.stu.Id,
						askpage: this.askpage,
						asklimit: this.asklimit
					}
				})
				this.stuform = res.data;
				this.askcount = res.count;
			},
			changgelimit(val) {
				this.asklimit = val;
				this.onSubmitnet();
			},
			chagngepage(val) {
				this.askpage = val;
				this.onSubmitnet();
			},
			LookhandleClick(row) {
				this.form = row;
				this.SelectVisible = true;
			},
			// 导出Excel
			downloadExcel() {
			        this.$confirm('将导出为excel文件，确认导出?', '提示', {
			          confirmButtonText: '确定',
			          cancelButtonText: '取消',
			          type: 'warning'
			        }).then(() => {
			          if(this.multipleSelection.length>0){
			            this.excelData = this.multipleSelection
			          }else{
			            this.excelData = this.tableData
			          }
			          this.export2Excel()
			        }).catch(() => {
			
			        })
			      },
			      // 数据写入excel
			      export2Excel() {
			        var that = this
			        require.ensure([], () => {
			          const {
			            export_json_to_excel
			          } = require('../../excel/Export2Excel.js') // 这里必须使用绝对路径，使用@/+存放export2Excel的路径
			          const tHeader = ['序号', '姓名', '性别', '年龄', '电话', '咨询师','QQ','创建时间'] // 导出的excel的表头字段
			          const filterVal = ['Id', 'Name', 'Sex', 'Age', 'Phone', 'AskName','QQ','CreateTime'] // 对象属性，对应于tHeader
			          const list = that.excelData //json数组对象，接口返回的数据
			          const data = that.formatJson(filterVal, list)
			          export_json_to_excel(tHeader, data, '学生表格') // 导出的表格名称
			        })
			      },
			      // 格式转换，直接复制即可
			      formatJson(filterVal, jsonData) {
			        return jsonData.map(v => filterVal.map(j => v[j]))
			      },
			handleSelectionChange(val) {
				this.multipleSelection = val;
			},
			handleSelectionChange(val) {
				this.multipleSelection = val;
			},
			async SetAsker() {
				console.log(this.multipleSelection.length)
				if (this.multipleSelection.length > 0) {
					const {
						data: res
					} = await this.$http.get('api/NetFol/pageUserlist')
					this.Askerlist = res.data;
					this.SetAskerVisible = true

				} else {
					this.SetAskerVisible = false
					this.$message.error("请先选择要修改的数据！")
				}
			},
			async SetAllAsker() {
				if (this.SetAskerForm.UserId == null) {
					this.$message.error("请先选择咨询师！")
				} else {
					for (var i = 0; i < this.multipleSelection.length; i++) {
						this.Ids[i] = this.multipleSelection[i].Id;
					}
					const {
						data: res
					} =
					await this.$http.get('api/Student/SetAllAsker', {
						params: {
							Id: this.SetAskerForm.UserId,
							Ids: this.Ids.toString()
						}
					})
					if (res.code == 0) {
						this.GetStudentTable();
						this.$message.success(res.msg);
						this.SetAskerVisible = false
					} else {
						this.$message.error(res.msg);
					}
				}
			},
			ReadRow(row) {
				this.RiZhi = row;
				this.ReadVisible = true;
			},
			closeadd() {
				this.AddStuForm = {};
				this.AddStuForm.Sex="男";
			},
			Selescts() {
									this.uid = parseInt(window.sessionStorage.getItem("token"));
									this.AddStuForm.NetPusherId = this.uid;
								},
			//点击按钮，添加学生
			AddStudent(){
				this.$refs.ruleForm.validate(async valid=>{
					if(!valid) return
					//可以发起添加用户的网络请求
				    const {data:res}=await this.$http.post('api/Student/AddStudent',this.AddStuForm)
				    if(res.code==0){
						this.$message.success('添加学生成功！')
						//隐藏添加用户的对话框
						this.AddStuVisible=false
						//重新获取用户列表数据
						this.GetStudentTable()
					}else{
						this.$message.error(res.msg)
					}
					
				})
			}
		},
		created: function() {
			this.GetStudentTable();
			this.getPagelist()
		}
	}
</script>

<style lang="=less" scoped>
</style>
